package com.mybatisplus.sunpineshop.controller;


import com.mybatisplus.common.core.Result;
import com.mybatisplus.sunpineshop.works.entity.SUser;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author GongXl
 * @Description 后端管理公共入口
 * @Date 2021/3/1 8:55
 * @Param
 * @return
 **/
@RestController
@RequestMapping("/api/admin_sys")
//@CrossOrigin
public class AdminSysController {

    /**
     * @Author GongXl
     * @Description 主页菜单列表
     * @Date 2021/3/3 11:46
     * @Param []
     * @return com.mybatisplus.common.core.Result
     **/
    @RequestMapping("/getMenuList")
    public Result getMenuList(){
        List<Map> menus = new ArrayList<Map>();
        for (int i = 0; i < 5; i++) {
            Map map = new HashMap();
            map.put("menuId",i);
            map.put("menuName","name"+i);
            menus.add(map);
        }
        Result res = Result.success("菜单列表",menus);
        return res;
    }
   /* @RequestMapping("/login")
    public Result selectUserList(@RequestBody SUser sUser){
        SUser sUserTemp = new SUser();
        sUserTemp.setUserName("z3");
        sUserTemp.setUserId(1l);
        Result res = Result.success("用户登录",sUserTemp);
        //TODO 先做一个假token数据
        res.put("token","token=fjkldasjflasdjfjsdalfdsa");
        return res;
    }*/

    @RequestMapping("/login")
    public Result selectUserList(@RequestBody SUser suser, String loginName,String loginPassword){
        SUser sUserTemp = new SUser();
        sUserTemp.setUserName("z3");
        sUserTemp.setUserId(1l);
        Result res = Result.success("用户登录",sUserTemp);
        //TODO 先做一个假token数据
        res.put("token","token=fjkldasjflasdjfjsdalfdsa");
        return res;
    }

}

